using StudyCompanion.Commons.Result;
using StudyCompanion.Core.Repository;
using StudyCompanion.Core.Services;
using StudyCompanion.Entity.System;
using StudyCompanion.IServices;

namespace StudyCompanion.Services;

public class RefillCardService : BaseService, IRefillCardService
{
    private readonly BaseRepository<ChargeCard> _chargeCardRepository;

    public RefillCardService(BaseRepository<ChargeCard> chargeCardRepository)
    {
        _chargeCardRepository = chargeCardRepository;
    }

    /// <summary>
    ///     充值卡
    /// </summary>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    public CommonResult<List<ChargeCard>> RefillCardList()
    => _chargeCardRepository.Where(x => x.IsValid == true)
        .OrderBy(x => x.Sort)
        .ToList();
}